import Koa from 'koa';
import bodyParser from 'koa-bodyparser';

import ENV from './env';
import router from './server';
import mvError from './server/middlewares/error';

const server = new Koa();

server.use(bodyParser()).use(mvError).use(router.routes()).use(router.allowedMethods());
server.listen(ENV.SERVER.PORT, () => {
  console.log(`> Ready on http://localhost:${ENV.SERVER.PORT}`);
});
